#ifndef EV1527_DECODER_H
#define EV1527_DECODER_H

#include <stdint.h>

#define RF433_BIT0_L    1000
#define RF433_BIT0_H    400
#define RF433_BIT1_L    400
#define RF433_BIT1_H    1000
#define RF433_SYNC_L    9000
#define RF433_SYNC_H    400
#define RF433_FILTER    200

#ifdef __cplusplus
extern "C" {
#endif

typedef void (*ev1527_data_callback_t)(uint32_t data);

typedef struct {
    uint8_t status;
    uint8_t bit_count;
		uint8_t data_count;
    uint32_t data;
    uint32_t data_buff[3];
		ev1527_data_callback_t callback;
} ev1527_decoder_t;

void ev1527_decoder_init(ev1527_decoder_t *decoder, ev1527_data_callback_t cb);
void ev1527_decoder_on_update(ev1527_decoder_t *decoder);
void ev1527_decoder_on_capture(ev1527_decoder_t *decoder, uint8_t level, uint16_t duration);

#ifdef __cplusplus
}
#endif

#endif // EV1527_DECODER_H
